﻿@model IEnumerable<WorkTimePrj.Models.Item>

@{
    ViewBag.Title = "用户工作量明细";
}
<!DOCTYPE html>
<html>
<head>
    <title>用户工作量明细</title>
     <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <style type="text/css">
        body{color:#000000;}
        h2{font-size:10pt;font-family:simsun;font-weight:normal;background:#197B30; height:35px; line-height:35px; padding-left:10px;color:#ffffff;}
        .WP_1{width:97%;margin:15px auto;}
        .Btn01{border:solid 1px #5381B3;color:#5381B3;}
        input[type='text'].TB01{width:135px;}
        table{border-collapse:collapse; margin:15px 0; border:solid 1px #A5A5A5;}
        table tr th{ background:#197B30; color:#ffffff;border-right:solid 1px #A5A5A5;border-bottom:solid 1px #A5A5A5;}
        table tr td{/*font-family:simsun;*/font-size:12px;text-align:left;color:#000000;border-right:solid 1px #A5A5A5;border-bottom:solid 1px #A5A5A5;}
        .WP_2{/*width:99.5%; margin:0 auto;*/ border:solid 1px #c0d6ef;padding:15px 0 0 0;background:#e4ecf5;}
        .WP_2 div{padding-bottom:10px;}
        .WP_2 div.WP_6{padding-bottom:0;}
        .WP_3{width:600px; text-align:left; margin:0 auto;/*float:left;*/}
        .Btn01{ border:solid 1px #5381B3;}
        .Label01{color:#440e62;}
        .Label02{color:#440e62;font-weight:bold;}
        .Text01{width:550px;}
        .WP_4{float:left; padding-top:5px;}
        .WP_5{float:left;}
        .WP_6{float:left;background:#440E62;color:#ffffff; margin-left:5px; width:15px; height:15px; line-height:15px;text-align:center;}
        .WP_7{display:block;border:solid 1px #c0d6ef;background:#e4ecf5;margin-top:15px;float:left;}
        .Select{border:solid 1px #A5A5A5;}
    </style>
     <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/DatePicker/WdatePicker.js")" type="text/javascript"></script>
     <script type="text/javascript">
         $(function () {
             //             $('#BtnSubmit').click(function () {
             //                 var date1 = new Date();
             //                 date1.setFullYear($dp.$D('TBStartTime').y, $dp.$D('TBStartTime').M - 1, $dp.$D('TBStartTime').d);
             //                 var dayofwk1 = date1.getDay();
             //                 var date2 = new Date();
             //                 date2.setFullYear($dp.$D('TBEndTime').y, $dp.$D('TBEndTime').M - 1, $dp.$D('TBEndTime').d);
             //                 var dayofwk2 = date2.getDay();
             //                 //debugger
             //                 if (dayofwk1 != 1 || dayofwk2 != 0) {
             //                     alert('日期选择错误！');
             //                     return false;
             //                 }
             //                 return true;
             //             });
             if (window.addEventListener) {
                 //其它浏览器的事件代码: Mozilla, Netscape, Firefox
                 //添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件，不用加on 
                 $('#BtnSubmit')[0].addEventListener('click', valDate, false);
             }
             else {
                 //IE 的事件代码 在原先事件上添加 add 方法
                 $('#BtnSubmit')[0].attachEvent('onclick', valDate);
             }
             $('#BtnExcel').click(function () {
                 $('#HAction').val('export');
                 window.document.forms[0].submit();
             });
             $('#BtnSubmit').click(function () {
             //debugger
                 var startTime = $('#TBStartTime').val();
                 var endTime = $('#TBEndTime').val();
                 var account = $('#ddlUser').val();
                 var pid = $('#ddlProject').val();
                 window.open('ListUser?startTime='+startTime+'&endTime='+endTime+'&account='+account+'&pid='+pid)
             });
         });
         function valDate() {
             var date1 = new Date();
             date1.setFullYear($dp.$D('TBStartTime').y, $dp.$D('TBStartTime').M - 1, $dp.$D('TBStartTime').d);
             var dayofwk1 = date1.getDay();
             var date2 = new Date();
             date2.setFullYear($dp.$D('TBEndTime').y, $dp.$D('TBEndTime').M - 1, $dp.$D('TBEndTime').d);
             var dayofwk2 = date2.getDay();
             //debugger
             if (dayofwk1 != 1 || dayofwk2 != 0) {
                 alert('日期选择错误！');
                 return false;
             }
             else {
                 return true;
             }
         }
         function pickedFunc1() {
             var dayofwk = $dp.cal.getP('w');
             if (dayofwk != '01')
                 alert('日期错误！只能选择星期一');
         }
         function pickedFunc2() {
             var dayofwk = $dp.cal.getP('w');
             if (dayofwk != '00')
                 alert('日期错误！只能选择星期日');
         }
</script>
</head>
<body>
 
@using (Html.BeginForm())
{
<div class="WP_1">
<h2>
用户工作量统计 &nbsp;&nbsp;&nbsp;
用户名 @ViewBag.account &nbsp;&nbsp;&nbsp;
<span class="Lbl02">@ViewBag.startTime</span> 至 <span class="Lbl02">@ViewBag.endTime</span>&nbsp;&nbsp;&nbsp; 
总计 @ViewBag.cnt 条
@{Html.RenderAction("VOTPartialView", new { account = ViewBag.account, startTime = ViewBag.startTime, endTime = ViewBag.endTime });}
</h2>
<div>
    <label class="Lbl01">开始时间</label>&nbsp;&nbsp;&nbsp;<input id="TBStartTime" name="TBStartTime"  class="TB01" type="text" value="@ViewBag.startTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:pickedFunc1})"/>
    <label class="Lbl01">结束时间</label>&nbsp;&nbsp;&nbsp;<input id="TBEndTime"  name="TBEndTime" class="TB01" type="text" value="@ViewBag.endTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:pickedFunc2})"/>
   <label class="Lbl01">用户</label> @Html.DropDownList("userSelectList", null,"---", new { @class = "Select",id="ddlUser"})
   <label class="Lbl01">项目</label> @Html.DropDownList("projectSelectList", null,"---", new { @class = "Select", id = "ddlProject"})
    <input id="BtnSubmit" type="button" class="Btn01" value="查询" />
</div>
@if (ViewBag.cnt != 0)
{
<table border="1">
    @{int i=0;
        foreach (var item in Model) {
    i=i+1;
    <tr>
        <td>
        <div class="WP_2 group">
        <div class="WP_6">@i</div>
         <div class="WP_3">
            <div >
            <span class="Label02">[@Html.DisplayFor(modelItem => item.Project.code)]</span>
            <span class="Label02">@Html.DisplayFor(modelItem => item.Project.display)</span>
            </div>
            <div>
            <label class="Label01">员工姓名：</label>
            <span>
            @Html.DisplayFor(modelItem => item.User_DisplayName)
           </span>&nbsp;&nbsp;&nbsp;
           <label class="Label01">时间段：</label>
            <span>
            @Html.DisplayFor(modelItem => item.worktime)
           </span>&nbsp;&nbsp;&nbsp;
           <label class="Label01">工作量：</label>
            <span>
            @Html.DisplayFor(modelItem => item.cost)H
           </span>
            </div>
            <div>
            <label class="Label01">单项内容：</label>
            <span>
            @Html.DisplayFor(modelItem => item.title)
           </span>
           </div>
              <div>
            <label class="Label01">确认状态： </label>
           
            @if (item.ack != null)
            {
            <span>
                @Html.DisplayFor(modelItem => item.ack_type)
           </span>
            }
            else
            {
                 <span style="color:Red;">
                未确认
           </span>
            }
           </div>
            </div>
            </div>
        </td>
    </tr>
}
}


</table>
}
else
{
<span class="WP_7">无统计数据</span>
}
</div>
     @Html.CommonnScript()
}

</body>
</html>
